package com.stephen.redisdemo.exception;

import com.stephen.redisdemo.entity.enums.ResultEnum;
import lombok.Getter;
import lombok.Setter;

/**
 * @author: stephen
 * @create: 2020-02-06 14:05
 * @description:
 */
@Getter
@Setter
public class BusinessException extends RuntimeException {

    private Integer code;

    private Object data;

    public BusinessException(String message) {
        super(message);
    }

    public BusinessException(Integer code,String message) {
        super(message);
        this.code = code;
    }

    public BusinessException(Integer code,String message,Object data) {
        super(message);
        this.code = code;
        this.data = data;
    }

    public BusinessException (ResultEnum resultEnum) {
        super(resultEnum.getMsg());
        this.code = resultEnum.getCode();
    }

    public BusinessException (ResultEnum resultEnum,Object data) {
        super(resultEnum.getMsg());
        this.code = resultEnum.getCode();
        this.data = data;
    }



}
